package top.jnaw.jee.utils;

public class CheckDataUtil {

  private CheckDataUtil() {
  }

  public static boolean isNull(Object object) {
    return object == null || "null".equals(object.toString()
        .trim()) || "".equals(object.toString().trim());
  }

  public static boolean noNull(Object object) {
    return object != null && !"".equals(object.toString()
        .trim()) && !"null".equals(object.toString().trim());
  }

  public static Object isNullToDefault(Object object, Object defaultObject) {
    return object != null && !"".equals(object.toString().trim()) &&
               !"null".equals(object.toString().trim())
           ? object
           : defaultObject;
  }

  public static String setNull(String str) {
    return str != null && !"".equals(str.trim())
               && !"null".equals(str.trim()) ? str : "";
  }
}
